package com.web.base.core.dao;

import org.springframework.stereotype.Repository;
import com.blue.jdbc.BaseDao;
import com.web.base.core.model.Bank;

/**
 * 银行数据库访问
 * 
 * @author 代码由 blue-code 框架生成
 * @since 1.0 2018年06月19日
 */
@Repository("coreBankDao")
public class BankDao extends BaseDao<Bank>
{
	public BankDao()
	{
	}
	
	@Override
	protected void query(StringBuilder sql, Bank param)
	{
		if (param != null)
		{
			if (param.getCode() != null && !param.getCode().isEmpty())
				sql.append(" and a.code=:code");
				
			if (param.getName() != null && !param.getName().isEmpty())
			{
				sql.append(" and a.name like :name");
				param.setName("%" + param.getName() + "%");
			}
			
			if (param.getSort() != null)
				sql.append(" and a.sort=:sort");
				
			if (param.getState() != null)
				sql.append(" and a.state=:state");
				
		}
		sql.append(" order by a.id desc");
	}
	
}
